package com.lianqu1990.morphling.dao.jpa.entity;
// Generated 2017-12-4 15:08:08 by Hibernate Tools 5.2.1.Final

import com.lianqu1990.morphling.dao.jpa.core.AbstractJsonType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.Type;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Types;
import java.util.Date;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * App generated by hbm2java
 */
@Data
@AllArgsConstructor
@NoArgsConstructor

@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "app")
public class App implements java.io.Serializable {

    private Integer id;
    private String name;
    private String description;
    private String contextPath;
    private int port;
    private String gitUrl;
    private String gitBranch;
    private String mvnModule;
    private String env;
    private byte serviceType;
    private byte deployType;
    private String currentPackVersion;
    private String adminUser;
    private AppProperties properties;
    private Date createTime;
    private int createUserid;
    private String createUsername;
    private byte state;


    @Id
    @GeneratedValue(strategy = IDENTITY)

    @Column(name = "id", unique = true, nullable = false)
    public Integer getId() {
        return this.id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Column(name = "name", nullable = false, length = 50)
    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name = "description", nullable = false)
    public String getDescription() {
        return this.description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Column(name = "context_path", nullable = false, length = 50)
    public String getContextPath() {
        return this.contextPath;
    }

    public void setContextPath(String contextPath) {
        this.contextPath = contextPath;
    }

    @Column(name = "port", nullable = false)
    public int getPort() {
        return this.port;
    }

    public void setPort(int port) {
        this.port = port;
    }


    @Column(name = "git_url", nullable = false)
    public String getGitUrl() {
        return this.gitUrl;
    }

    public void setGitUrl(String gitUrl) {
        this.gitUrl = gitUrl;
    }

    @Column(name = "git_branch", nullable = false, length = 50)
    public String getGitBranch() {
        return this.gitBranch;
    }

    public void setGitBranch(String gitBranch) {
        this.gitBranch = gitBranch;
    }

    @Column(name = "env", nullable = false, length = 20)
    public String getEnv() {
        return this.env;
    }

    public void setEnv(String env) {
        this.env = env;
    }

    @Column(name = "service_type", nullable = false)
    public byte getServiceType() {
        return this.serviceType;
    }

    public void setServiceType(byte serviceType) {
        this.serviceType = serviceType;
    }

    @Column(name = "deploy_type", nullable = false)
    public byte getDeployType() {
        return this.deployType;
    }

    public void setDeployType(byte deployType) {
        this.deployType = deployType;
    }

    @Column(name = "mvn_module", nullable = false, length = 50)
    public String getMvnModule() {
        return this.mvnModule;
    }

    public void setMvnModule(String mvnModule) {
        this.mvnModule = mvnModule;
    }

    @Column(name = "current_pack_version", nullable = false, length = 50)
    public String getCurrentPackVersion() {
        return this.currentPackVersion;
    }

    public void setCurrentPackVersion(String currentPackVersion) {
        this.currentPackVersion = currentPackVersion;
    }

    @Column(name = "admin_user", nullable = false)
    public String getAdminUser() {
        return this.adminUser;
    }

    public void setAdminUser(String adminUser) {
        this.adminUser = adminUser;
    }

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_time", nullable = false, length = 19)
    public Date getCreateTime() {
        return this.createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Column(name = "create_userid", nullable = false)
    public int getCreateUserid() {
        return this.createUserid;
    }

    public void setCreateUserid(int createUserid) {
        this.createUserid = createUserid;
    }

    @Column(name = "create_username", nullable = false, length = 50)
    public String getCreateUsername() {
        return this.createUsername;
    }

    public void setCreateUsername(String createUsername) {
        this.createUsername = createUsername;
    }

    @Column(name = "state", nullable = false)
    public byte getState() {
        return this.state;
    }

    public void setState(byte state) {
        this.state = state;
    }

    @Column(name = "settings", length = 65535)
    @Type(type = "com.lianqu1990.morphling.dao.jpa.entity.App$AppJsonType")
    public AppProperties getProperties() {
        return properties;
    }

    public void setProperties(AppProperties properties) {
        this.properties = properties;
    }

    @Data
    public static class AppProperties implements Serializable {
        private static final long serialVersionUID = 1L;

    }


    public static class AppJsonType extends AbstractJsonType {
        private static final long serialVersionUID = 1L;

        @Override
        public int getSqlType() {
            return Types.LONGVARCHAR;
        }

        @Override
        public Class getJavaType() {
            return AppProperties.class;
        }
    }

}
